package com.android.webframework;

import java.util.Hashtable;

public class PHashtable extends PDictionary {
	private Hashtable<Object, Object> table;
	
	/**
	 * Instantiates a Hashtable
	 */
	public PHashtable()
	{
		table = new Hashtable<Object, Object>();
	}
	
	/**
	 * Inserts a key value pair to this PHashtable
	 * @param  key  a key for the hashing function
	 * @param  value the value to where the key maps
	 */
	public void insert(Object key, Object value)
	{
		table.put(key, value);
	}
	
	/**
	 * Returns a value from this PHashtable
	 * @param  key  a key for the hashing function
	 * @return the value from where the key mapped
	 * @see Object
	 */
	public Object get(Object key) throws ObjectNotFoundException
	{
		try
		{
			if(table.get(key) != null)
				return table.get(key);
			else
				throw new ObjectNotFoundException();
		}
		catch(Exception e) {
			e.printStackTrace();
			return null;
		}
	}
}
